use axum::extract::Query;
use std::collections::HashMap;
use crate::handler::common::AppResult;

/// 测试查询参数接口
#[utoipa::path(
    get,
    path = "/api/test/query",
    tag = "test",
    summary = "测试查询参数",
    description = "用于测试查询参数处理的接口",
    params(
        ("query" = String, Query, description = "查询参数")
    ),
    responses(
        (status = 200, description = "查询成功", body = AppResult<HashMap<String, String>>)
    )
)]
pub async fn test_query(Query(query): Query<HashMap<String, String>>) -> AppResult<HashMap<String, String>> {
    // 处理查询参数
    println!("接收到的查询参数: {:?}", query);

    // 返回成功响应，包含查询参数数据
    AppResult {
        data: Some(query),
        code: 200,
        message: Some("查询参数处理成功".to_string()),
    }
}
